﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DBLayer;
using System.Data;
using System.Data.SqlClient;

namespace BALayer
{
    public class DBLop
    {
        DAL db = null;
        public DBLop()
        {
            db = new DAL();
        }
        //Lay Lop
        public DataSet LayLop()
        {
            return db.ExecuteQueryDataSet("Select * From Lop", CommandType.Text, null);
        }
        //Them Lop
        public bool ThemLop(ref string err, string MaLop, string TenLop)
        {
            return db.MyExecuteNonQuery("SpThemLop", CommandType.StoredProcedure, ref err,
                new SqlParameter("@MaLop", MaLop),
                new SqlParameter("@TenLop", TenLop));
        }
        //Xoa Lop
        public bool XoaLop(ref string err, string MaLop)
        {
            return db.MyExecuteNonQuery("SpXoaLop", CommandType.StoredProcedure, ref err, new SqlParameter("@MaLop", MaLop));
        }
        //Cap nhat Lop
        public bool CapNhatLop(ref string err, string MaLop, string TenLop)
        {
            return db.MyExecuteNonQuery("SpCapNhatLop", CommandType.StoredProcedure, ref err,
                new SqlParameter("@MaLop", MaLop),
                new SqlParameter("@TenLop", TenLop));
        }
    }
}
